/***********************************************
 This file is part of redia-bapps-main-ios.
 
 Copyright (c) 2015 Redia A/S
 
 Redia-bapps-main-ios is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 redia-bapps-main-ios is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with redia-bapps-main-ios.  If not, see <http://www.gnu.org/licenses/>.
 
 *********************************************** */

//
//  BAStandardResultObject.h
//  redia-bapps-ios
//
//  Created by Henrik Lynbech on 14/08/13.
//  Copyright (c) 2013 redia. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "JSONEncoding.h"

/**
 A standard result object from the RPC server. 
 If @propery result is true, @property data will 
 hold the data with the response from the server.
 @property message and @property code will contain a message and result code
 from the server, mainly used in case of errors.
 */
@interface BAStandardResultObject : NSObject <JSONEncoding>

/**
 Result code from server, especially if an error
 was encountered when performing the request
 */
@property (nonatomic) int code;

/**
 The raw data returned from the request
 */
@property (nonatomic, strong) id jsonData;

/**
 The parsed object (if any)
 */
@property (nonatomic, strong) id parsedData;

/**
 The UI language specified for server result messages
 */
@property (nonatomic, strong) NSString* language;

/**
 Server result message, mainly used in case of errors
 */
@property (nonatomic, strong) NSString* message;

/**
 If true, the request was performed succesfully,
 and the @property data field holds the corresponding
 return value from the request.
 */
@property (nonatomic) BOOL result;

-(BOOL)parseDataFieldToObjectOfClass:(Class<JSONEncoding>)class_object;

@end
